bitkeeper revision 1.1159.79.14 (41517b25DFZMFi8N_o4qPoyFK7RHNw)
authorcl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Wed, 22 Sep 2004 13:16:21 +0000 (13:16 +0000)
committercl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Wed, 22 Sep 2004 13:16:21 +0000 (13:16 +0000)
Use HYPERVISOR_set_timer_op and HYPERVISOR_block instead of busy-yielding.

netbsd-2.0-xen-sparse/sys/arch/xen/i386/locore.S
netbsd-2.0-xen-sparse/sys/arch/xen/include/xen.h
netbsd-2.0-xen-sparse/sys/arch/xen/xen/clock.c

index 6a1a3e7bd8ab295d42d9f5b19a090969afed6c1a..ed0946cb9b2bcbe1f3229863f025307a39b1c38f 100644 (file)
@@ -1567,6 +1567,7 @@ idle_zero:
        pushl   $IPL_NONE
        call    _C_LABEL(Xspllower)
        addl    $4,%esp
+       jmp     idle_start
 4:
        call    _C_LABEL(uvm_pageidlezero)
        CLI(%eax)
@@ -1577,6 +1578,9 @@ idle_loop:
        movl    _C_LABEL(uvm)+UVM_PAGE_IDLE_ZERO,%ecx
        testl   %ecx,%ecx
        jnz     idle_zero
+       call    _C_LABEL(idle_block)
+       cmpl    $0,_C_LABEL(sched_whichqs)
+       jnz     idle_exit
        STIC(%eax)
        jz      4f
        call    _C_LABEL(stipending)
index 48bff484b926a5b6c00e0282e815eedc0934872c..274dad8410aef3f9180f2343d18e2d8268f177a7 100644 (file)
@@ -54,6 +54,8 @@ void  xenmachmem_init(void);
 void   xenprivcmd_init(void);
 void   xenvfr_init(void);
 
+void   idle_block(void);
+
 #ifdef XENDEBUG
 void printk(const char *, ...);
 void vprintk(const char *, va_list);
index fa7d986eb9b85a4a94c27a3a0f17171f144ef699..16add4e591833558a20b81e88d06f3b7218752bd 100644 (file)
@@ -257,3 +257,17 @@ void
 setstatclockrate(int arg)
 {
 }
+
+void
+idle_block(void)
+{
+
+       /*
+        * We set the timer to when we expect the next timer
+        * interrupt.  We could set the timer to later if we could
+        * easily find out when we will have more work (callouts) to
+        * process from hardclock.
+        */
+       if (HYPERVISOR_set_timer_op(processed_system_time + NS_PER_TICK) == 0)
+               HYPERVISOR_block();
+}